package com.hk.controller;

import com.hk.Enume.OperationType;
import com.hk.annotation.AotoFile;
import com.hk.constant.LogConstaant;
import com.hk.core.Result;
import com.hk.core.roleResult.PageRoleResult;
import com.hk.service.SysNoticeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequestMapping("/system/notice")
public class SysNoticeController {
    @Autowired
    private SysNoticeService sysNoticeService;
//    根据状态分页查询通知
    @GetMapping("/pagelist/{status}")
    public PageRoleResult listByStatus(@PathVariable Integer status){
      return   sysNoticeService.listByStatus(status);

    }
//    根据id查询通知
    @AotoFile(value = OperationType.PUT,title = LogConstaant.NOTICECENTER_LOG)
    @PutMapping("/{noticeId}")
    public Result selcetById(@PathVariable Integer noticeId){

        return Result.success(sysNoticeService.selcetById(noticeId));
    }
    //    通过状态查询全部
    @GetMapping("/list/{status}")
    public PageRoleResult list(@PathVariable Integer status){
        return   sysNoticeService.listByStatus(status);

    }

}
